package com.lagou.mapper;

import com.lagou.pojo.User;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.mybatis.caches.redis.RedisCache;

import java.util.List;

@CacheNamespace(implementation = RedisCache.class)
public interface IUserMapper {

    List<User> findAll();

    @Options
    @Select({"select * from user where id = #{id}"})
    User findUserById(int id);

    @Update({"update user set username=#{username} where id = #{id}"})
    void updateUser(User user);
}
